/**
 * Project Name:SimonFramework
 * File Name:NonViewAware.java
 * Package Name:com.simon.framework.image.core.imageaware
 * Date:2016-5-19 下午3:49:40
 * Copyright (c) 2016, simon@cmonbaby.com All Rights Reserved.
 */
package com.cmonbaby.images.core.imageaware;

import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.text.TextUtils;
import android.view.View;

import com.cmonbaby.images.core.assist.ImageSize;
import com.cmonbaby.images.core.assist.ViewScaleType;

/**
 * <p>Author:      Simon
 * <p>QO:          8950764
 * <p>Email:       simon@cmonbaby.com
 * <p>WebSize:     https://www.cmonbaby.com
 * <p>Version:     1.0.0
 * <p>Date:        2020/12/29
 * <p>Description: imageaware提供所需信息的原始图像处理而显示图像做什么。当用户需要用到它时，只需加载和解码图像，并得到它
 */
public class NonViewAware implements ImageAware {

    protected final String imageUri;
    protected final ImageSize imageSize;
    protected final ViewScaleType scaleType;

    public NonViewAware(ImageSize imageSize, ViewScaleType scaleType) {
        this(null, imageSize, scaleType);
    }

    public NonViewAware(String imageUri, ImageSize imageSize, ViewScaleType scaleType) {
        if (imageSize == null) throw new IllegalArgumentException("imageSize must not be null");
        if (scaleType == null) throw new IllegalArgumentException("scaleType must not be null");

        this.imageUri = imageUri;
        this.imageSize = imageSize;
        this.scaleType = scaleType;
    }

    @Override
    public int getWidth() {
        return imageSize.getWidth();
    }

    @Override
    public int getHeight() {
        return imageSize.getHeight();
    }

    @Override
    public ViewScaleType getScaleType() {
        return scaleType;
    }

    @Override
    public View getWrappedView() {
        return null;
    }

    @Override
    public boolean isCollected() {
        return false;
    }

    @Override
    public int getId() {
        return TextUtils.isEmpty(imageUri) ? super.hashCode() : imageUri.hashCode();
    }

    @Override
    public boolean setImageDrawable(Drawable drawable) { // Do nothing
        return true;
    }

    @Override
    public boolean setImageBitmap(Bitmap bitmap) { // Do nothing
        return true;
    }

}

